﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for Acount
/// </summary>
public class AcountDTO
{
    private string firstName;
    private string lastName;
    private DateTime birthDay;
    private bool male;
    private string pass;
    private string phone;
    private string email;
    private int homeTown;
    private string address;
    private string iDAcount;
    private string lastLogin;

    public string LastLogin
    {
        get { return lastLogin; }
        set { lastLogin = value; }
    }
    public string IDAcount
    {
        get { return iDAcount; }
        set { iDAcount = value; }
    } 
    private double longitude;   
    private double latitude;   
    private string bankNumber;   
    private string website;
    private string cMND;   
    private byte role;   
    private int bankID;
    private string avarta;
    private bool isOpenID;
    private LogReviews logReviews;
    private List<MailDTO> inboxMails;
    public List<MailDTO> InboxMails
    {
        get {            
            if(inboxMails == null)
            {
                if (iDAcount == "")
                    return null;
                else
                {
                    inboxMails = DBAccess.getListInbox(iDAcount);
                    return inboxMails;
                }
            }
            else
                return inboxMails;
        }        
        set { inboxMails = value; }
    }
    private List<MailDTO> outboxMails;

    public List<MailDTO> OutboxMails
    {
        get
        {
            if (outboxMails == null)
            {
                if (iDAcount == "")
                    return null;
                else
                {
                    outboxMails = DBAccess.getListOutbox(iDAcount);
                    return inboxMails;
                }
            }
            else
                return outboxMails;
        }        
        set { outboxMails = value; }
    }
    public LogReviews LogReviews
    {
        get { return logReviews; }
        set { logReviews = value; }
    }
    public bool IsOpenID
    {
        get { return isOpenID; }
        set { isOpenID = value; }
    }
   
    public string Avarta
    {
        get { return avarta; }
        set { avarta = value; }
    }
    public string FirstName
    {
        get { return firstName; }
        set { firstName = value; }
    }
    public string LastName
    {
        get { return lastName; }
        set { lastName = value; }
    }
    public DateTime BirthDay
    {
        get { return birthDay; }
        set { birthDay = value; }
    }
    public bool Male
    {
        get { return male; }
        set { male = value; }
    }
    public string Pass
    {
        get { return pass; }
        set { pass = MyFunction.MahoaMatKhau(value); }
    }
    public int HomeTown
    {
        get { return homeTown; }
        set { homeTown = value; }
    }
    public string Phone
    {
        get { return phone; }
        set { phone = value; }
    }
    public string Email
    {
        get { return email; }
        set { email = value; }
    }
    public string Website
    {
        get { return website; }
        set { website = value; }
    }
    public string CMND
    {
        get { return cMND; }
        set { cMND = value; }
    }
    public byte Role
    {
        get { return role; }
        set { role = value; }
    }
    public int BankID
    {
        get { return bankID; }
        set { bankID = value; }
    }
    public string BankNumber
    {
        get { return bankNumber; }
        set { bankNumber = value; }
    }
    public double Latitude
    {
        get { return latitude; }
        set { latitude = value; }
    }
    public double Longitude
    {
        get { return longitude; }
        set { longitude = value; }
    }
    public string Acount
    {
        get { return iDAcount; }
        set { iDAcount = value; }
    }
    public string Address
    {
        get { return address; }
        set { address = value; }
    }
	public AcountDTO()
	{        
        isOpenID = false;
        LogReviews = new LogReviews();
        logReviews.Reviews.Add(1, 0);
        logReviews.Reviews.Add(2, 0);
        logReviews.Reviews.Add(3, 0);
	}
    public string getFullName()
    {
        return firstName.Trim() + " " + lastName.Trim();
    }   
}